//
//  MyTabbarViewController.m
//  shike
//
//  Created by RegentSoft on 2017/4/19.
//  Copyright © 2017年 RegentSoft. All rights reserved.
//

#import "MyTabbarViewController.h"
#import "DynamicViewController.h"
#import "FoundViewController.h"
#import "PersonalViewController.h"
@interface MyTabbarViewController ()<UITabBarControllerDelegate>

@end

@implementation MyTabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSArray *viewControllerTitleArr = [NSArray arrayWithObjects:@"动态",@"发现",@"我的", nil];
    NSArray *unSelectedImageArr = [NSArray arrayWithObjects:@"dynamic1", @"found1", @"personal1", nil];
    NSArray *selectedImageArr = [NSArray arrayWithObjects:@"dynamic2", @"found2", @"personal2", nil];
    NSArray *viewControllers = [NSArray arrayWithObjects:[[DynamicViewController alloc] init],[[FoundViewController alloc] init], [[PersonalViewController alloc] init],nil];
    NSMutableArray *mutableArr = [NSMutableArray array];
    for (int i = 0; i< viewControllers.count; i++) {
        UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:[viewControllers objectAtIndex:i]];
        navigation.tabBarItem = [[UITabBarItem alloc] initWithTitle:[viewControllerTitleArr objectAtIndex:i] image:[[UIImage imageNamed:[unSelectedImageArr objectAtIndex:i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:[selectedImageArr objectAtIndex:i]]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
        [mutableArr addObject:navigation];
        switch (i) {
            case 0:
                self.dynamicNavigationController = navigation;
                break;
            case 1:
                self.foundNavigationController = navigation;
                break;
            case 2:
                self.persinalNavigationController = navigation;
                break;
            case 3:
                break;
                
            default:
                break;
        }
        
    }
    self.viewControllers = mutableArr;
    self.tabBarController.tabBar.barStyle = UIBarStyleDefault;
    //    self.tabBar.tintColor = APPCOLOR(1);
    self.selectedIndex = 0;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
